﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 绘制多边形
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Pen pen = new Pen(Color.Black, 1);
            //定义多边形各个顶点，创建一个数组
            Point A=new Point(30,30);
            Point B=new Point(60,30);
            Point C=new Point(60,60);
            Point D=new Point(30,60);
            Point[]a=new Point[]{A,B,C,D};
            //
            g.DrawPolygon(pen, a);//绘制多边形的语法格式
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}
